# -*- coding: utf-8 -*-
import threading
from threading import Lock

total = 0
lock = Lock()


def add():
    global total
    #global lock
    for i in range(1000000):
        #lock.acquire()
        total += 1
        #lock.release()

def desc():
    global total
    #global lock
    for i in range(1000000):
        #lock.acquire()
        total -= 1
        #lock.release()


t1 = threading.Thread(target=add)
t2 = threading.Thread(target=desc)
t1.start()
t2.start()
t1.join()
t2.join()
print(total)
